<script setup lang="ts">
// 定义事件的名称和类型
const emit = defineEmits<{
  'update-title':[title:string]
}>()

// 事件回调
const updateTitleHandle = ()=>{
  emit('update-title', 'this is new title')
}
</script>
<template>
<div>
  <button @click="updateTitleHandle">更新标题</button>
</div>
</template>
